package design.event;

/**
 * 事件源 : 曹某;   发布了新书: android 2 ! ... ...
 * 小花发现了曹某的新书:android 2 !
 * 小红发现了曹某的新书:android 2 !
 */
public class TestDesign {

    public static void main(String[] args) {
        Reader reader1 = new Reader("小红");
        Reader reader2 = new Reader("小花");
        Writer writer = new Writer("曹某");

        //小红关注了曹某
        writer.addWriterListener(reader1);
        writer.addWriterListener(reader2);
        //作者在注册中心注册了
        WriterManager.getInstance().addWriter(writer);
        //作者发布新书
        writer.pushBook("android 2 !");

    }
}
